package components.player
{
	import UIFree.uif_component;
	
	import components.c_component;
	
	import flash.display.GraphicsPathCommand;
	import flash.display.GraphicsPathWinding;
	import flash.geom.Rectangle;
	
	public class c_playButton extends c_panelButton {
		private var _state: Boolean = false;
		public function c_playButton(parent:uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, styleClass:Object='', onClick: Function=null) {
			super(parent, ax, ay, awidth, aheight, styleClass, onClick);
			
		}
		
		public function get playState(): Boolean {
			return _state;
		}
		
		public function set playState(a_set: Boolean): void {
			_state = a_set;
			repaint();
		}
		
		override protected function getDrawPath():Object {
			var ir: Rectangle = getInner();
			var result: Object
			if (!_state) {
				result = {
					commands: new <int>[
						1,2,2,2
					],
					data: new <Number>[
						ir.x, ir.y,
						ir.right, ir.y + ir.height / 2,
						ir.x, ir.bottom,
						ir.x, ir.y
					],
					winding: GraphicsPathWinding.EVEN_ODD
				}
			} else {
				var t1: Number = ir.x + ir.width / 3; 
				var t2: Number = ir.x + ir.width / 3 * 2; 
				result = {
					commands: new <int>[
						1,2,2,2,2,
						1,2,2,2,2
					],
					data: new <Number>[
						ir.x, ir.y,
						t1, ir.y,
						t1, ir.bottom,
						ir.x, ir.bottom,
						ir.x, ir.y,
						
						
						t2, ir.y,
						ir.right, ir.y,
						ir.right, ir.bottom,
						t2, ir.bottom,
						t2, ir.y,
					],
					winding: GraphicsPathWinding.EVEN_ODD
				}
			}
			return result;
		}
	}
}